package top.zhangjianyong.tools.model;

import lombok.Data;
import top.zhangjianyong.tools.constant.CanteenMeal;

/**
 * @author ： zhangjianyong
 * @date ： 2022/11/23 9:21 AM
 */
@Data
public class MealConfig {
    private CanteenMeal meal;
    private final Integer number;
    private Integer tmpNum;
    private String cc;//1-早餐 2-午餐 3-晚餐

    public MealConfig(CanteenMeal meal, Integer number, String cc) {
        this.meal = meal;
        this.number = number;
        this.tmpNum = number;
        this.cc = cc;
    }

    public static MealConfig getConfig(String name, Integer number, String cc) {
        CanteenMeal meal = CanteenMeal.getByName(name);
        return new MealConfig(meal, number, cc);
    }

    public void reset() {
        this.tmpNum = this.number;
    }

    public void reduce() {
        this.tmpNum--;
    }

}
